
function delSellOrder() {

	//var table = document.getElementById("info_table");
	var checkboxNo = document.getElementsByName("rowlist");
	var stockOrder = document.getElementById("stockOrder");
	var list = new Array();
	var j = 0;
	for (var i = checkboxNo.length - 1; i >= 0; i = i - 1) {
		if (checkboxNo[i].checked) {
			list[j] = checkboxNo[i].parentElement.parentElement.rowIndex;
		}
	}
	if (list.length < 1) {
		//
		alert("\u8bf7\u9009\u62e9\u4f60\u60f3\u8981\u5220\u9664\u7684\u8bb0\u5f55");
	} else {
		if (list.length > 0) {
			if (confirm("\u786e\u5b9a\u8981\u5220\u9664\u5417\uff1f")) {
				stockOrder.action = "sellOrder!del.action";
				stockOrder.submit();
		    //j=checkboxNo[m].parentElement.parentElement.rowIndex ;
			//table.deleteRow(j);					
			}//endif
		}
	}//end else
}//end delrow
function auditingSellOrder() {

	var checkboxNo = document.getElementsByName("rowlist");
	var stockOrder = document.getElementById("stockOrder");
	var j = 0;
	for (var i = checkboxNo.length - 1; i >= 0; i = i - 1) {
		if(checkboxNo[i].checked)
		{
			
			j = j + 1;
		}
	}
	if (j < 1) {
		alert("\u6e05\u9009\u62e9\u8981\u5ba1\u6838\u7684\u9879\u76ee\uff01");
	} else {
		if (j > 0) {
			stockOrder.action = "sellOrder!auditing.action";
			stockOrder.submit();
		    //j=checkboxNo[m].parentElement.parentElement.rowIndex ;
			//table.deleteRow(j);					
			//endif
		}
	}//end else
}//end delrow
function unauditingSellOrder() {

	//var table = document.getElementById("info_table");
	var checkboxNo = document.getElementsByName("rowlist");
	var stockOrder = document.getElementById("stockOrder");
	var j = 0;
	for (var i = checkboxNo.length - 1; i >= 0; i = i - 1) {
		if(checkboxNo[i].checked)
		{
			j = j + 1;			
		}

	}
	if (j < 1) {
		//
		alert("\u8bf7\u9009\u62e9\u4f60\u60f3\u8981\u5220\u9664\u7684\u8bb0\u5f55");
	} else {
		if (j > 0) {
			stockOrder.action = "sellOrder!unauditing.action";
			stockOrder.submit();
		    //j=checkboxNo[m].parentElement.parentElement.rowIndex ;
			//table.deleteRow(j);
			//endif
		}
	}//end else
}//end delrow


function displySellOrder()
{
	var checkboxNo = document.getElementsByName("rowlist");
	var stockOrder = document.getElementById("stockOrder");
	var j = 0;
	
	for(var i = checkboxNo.length - 1; i >= 0; i = i - 1)
	{
		if(checkboxNo[i].checked)
		{
			j = j + 1;
		}
	}
	
	if(j < 1)
	{
		alert("没有选中要产看的销售订单！");
	}
	else if(j > 1)
	{
		alert("一次只能查看一个销售订单信息！");
	}
	else
	{
		stockOrder.action = "sellOrder!display.action";
		stockOrder.submit();
	}
	
}


function updateSellOrder()
{
	var checkboxNo = document.getElementsByName("rowlist");
	var stockOrder = document.getElementById("stockOrder");
	var j = 0;
	
	for(var i = checkboxNo.length - 1; i >= 0; i = i - 1)
	{
		if(checkboxNo[i].checked)
		{
			j = j + 1;
		}
	}
	
	if(j < 1)
	{
		alert("没有选中要产看的销售订单！");
	}
	else if(j > 1)
	{
		alert("一次只能查看一个销售订单信息！");
	}
	else
	{
		stockOrder.action = "sellOrder!updateInput.action";
		stockOrder.submit();
	}
	
}


//增加行
function addRowOfSellOrderList() {
	var t = document.getElementById("mbody");
	var row = t.insertRow(t.rows.length);
	var i = t.rows.length - 2;
	var id = "textSuggest" + i;
	var col = row.insertCell(0);
	col.innerHTML = "<td><input  type='checkbox' name='checkbox' value='false' /></td>";
	col = row.insertCell(1);
	col.innerHTML = "<td><input name='materialIdArr' type='text' size='7'/></td>";
	col = row.insertCell(2);
	col.innerHTML = "<td><input name='unitArr' type='text' size='8'/></td>";
	col = row.insertCell(3);
	col.innerHTML = "<td><input name='amountArr' type='text' size='8'/></td>";
	col = row.insertCell(4);
	col.innerHTML = "<td><input name='unitPriceArr' type='text'size='7'/></td>";
	col = row.insertCell(5);
	col.innerHTML = "<td><input name='addTaxArr' type='text'size='7'/></td>";
	col = row.insertCell(6);
	col.innerHTML = "<td><input name='moneyArr' type='text'size='7'/></td>";
	col = row.insertCell(7);
	col.innerHTML = "<td><input name='taxRateArr' type='text'size='7'/></td>";
	col = row.insertCell(8);
	col.innerHTML = "<td><input name='discountRateArr' type='text'size='7'/></td>";
	col = row.insertCell(9);
	col.innerHTML = "<td><input name='discountMoneyArr' type='text'size='7'/></td>";
	col = row.insertCell(10);
	col.innerHTML = "<td><input name='realAddTaxArr' type='text'size='7'/></td>";
	col = row.insertCell(11);
	col.innerHTML = "<td><input name='sellTaxMoneyArr' type='text'size='7'/></td>";
	col = row.insertCell(12);
	col.innerHTML = "<td><input name='priceAndTaxArr' type='text'size='7'/></td>";
}

function addRowForUpdate() {
	var t = document.getElementById("mbody");
	var row = t.insertRow(t.rows.length);
	var i = t.rows.length - 2;
	var id = "textSuggest" + i;
	var col = row.insertCell(0);
	col.innerHTML = "<td><input  type='checkbox' name='checkbox' value='false' /></td>";
	col = row.insertCell(1);
	col.innerHTML = "<td><input name='materialIdArr' type='text' size='20'/></td>";
	col = row.insertCell(2);
	col.innerHTML = "<td><input name='unitArr' type='text' size='20'/></td>";
	col = row.insertCell(3);
	col.innerHTML = "<td><input name='amountArr' type='text' size='20'/></td>";
	col = row.insertCell(4);
	col.innerHTML = "<td><input name='unitPriceArr' type='text'size='20'/></td>";
	col = row.insertCell(5);
	col.innerHTML = "<td><input name='addTaxArr' type='text'size='20'/></td>";
	col = row.insertCell(6);
	col.innerHTML = "<td><input name='moneyArr' type='text'size='20'/></td>";
	col = row.insertCell(7);
	col.innerHTML = "<td><input name='taxRateArr' type='text'size='20'/></td>";
	col = row.insertCell(8);
	col.innerHTML = "<td><input name='discountRateArr' type='text'size='20'/></td>";
	col = row.insertCell(9);
	col.innerHTML = "<td><input name='discountMoneyArr' type='text'size='20'/></td>";
	col = row.insertCell(10);
	col.innerHTML = "<td><input name='realAddTaxArr' type='text'size='20'/></td>";
	col = row.insertCell(11);
	col.innerHTML = "<td><input name='sellTaxMoneyArr' type='text'size='20'/></td>";
	col = row.insertCell(12);
	col.innerHTML = "<td><input name='priceAndTaxArr' type='text'size='20'/></td>";
}


//增加行
function addRowOfSellInvoiceList() {
	var t = document.getElementById("mbody");
	var row = t.insertRow(t.rows.length);
	var i = t.rows.length - 2;
	var id = "textSuggest" + i;
	var col = row.insertCell(0);
	col.innerHTML = "<td><input  type='checkbox' name='checkbox' value='false' /></td>";
	col = row.insertCell(1);
	col.innerHTML = "<td><input name='logisticsArr' type='text'size='7'/></td>";
	col = row.insertCell(2);
	col.innerHTML = "<td><input name='unitArr' type='text' size='8'/></td>";
	col = row.insertCell(3);
	col.innerHTML = "<td><input name='amountArr' type='text' size='8'/></td>";
	col = row.insertCell(4);
	col.innerHTML = "<td><input name='unitPriceArr' type='text'size='7'/></td>";
	col = row.insertCell(5);
	col.innerHTML = "<td><input name='discountArr' type='text'size='7'/></td>";
	col = row.insertCell(6);
	col.innerHTML = "<td><input name='postilCodeArr' type='text'size='7'/></td>";
	col = row.insertCell(7);
	col.innerHTML = "<td><input name='remark' type='text'size='18'/></td>";
	col = row.insertCell(8);
	col.innerHTML = "<td><input name='taxRateArr' type='text'size='7'/></td>";
}





	// 勾选每行的checkbox，可以删除多行
function delOnlyPage() {
	//得到表格对象和name为checkbox的复选框
	var table=document.getElementById("info_table");
	var checkboxNo=document.getElementsByName("checkbox");
	
	var j=0;
	var k=0 ;
	//循环删除选中的记录
	for(var i=checkboxNo.length-1;i>=0;i = i - 1){
	
		if(checkboxNo[i].checked){
			k = k + 1;
			j=checkboxNo[i].parentElement.parentElement.rowIndex ;
			//提示用户对要删除的记录进行确认，yes删除所选记录，no不进行任何操作
			//if(confirm("确定要删除吗"))
			table.deleteRow(j);				
		}
	}
	if(k<1){
		//用户没有选择任何记录就点击删除按钮，给出提示信息
		alert("请选择你想要删除的记录");  
	}
}





